from pydantic import BaseModel
from typing import List, Optional

class UserCreate(BaseModel):
    username: str
    password: str

class UserOut(BaseModel):
    username: str

    class Config:
        from_attributes = True

class Token(BaseModel):
    access_token: str
    token_type: str

class StockData(BaseModel):
    date: str  # YYYY-MM-DD
    code: str
    close: float
    open: float
    low: float
    high: float
    volume: float
    turnover: float
    action: str
    POWERLINE: float
    ENTRYBUY: bool
    BOTTOMBUY: bool
    BOTTOMUPBUY: bool
    POTENTIALBUY: bool
    STARK: Optional[bool] = None  # Changed to optional
    DRAGONBUY: bool
    POWERDOWNSELL: bool
    CLEANSELL: bool
    STAGESELL: bool
    XYS1: float
    XYS2: float
    sharpe_ratio: float

class StockResponse(BaseModel):
    code: str
    data: List[StockData]